// 路由守卫文件
import router from '@/router'
import { useUserStore } from './stores/userStote'
import { ElMessage } from 'element-plus'

// 白名单
const whiteList = ['/login','/404']

router.beforeEach((to, from, next) => {
  const userStore = useUserStore()
if (whiteList.includes(to.path)) {
  next()
}else{
  if(userStore.token){
    next()
  }else{
    next('/login')
    ElMessage.warning('身份信息有误，请先登录')
  }
}
})